/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.registration.business.security.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import static javax.persistence.metamodel.PluralAttribute.CollectionType.SET;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Innotommy91
 */
@Entity
@IdClass(FriendId.class)
public class Friend implements Serializable 
{
    private static final long serialVersionUID = 1L;
    
    @Id
    @ManyToOne
    @NotNull(message = "May not be empty")
    private User sender;
    
    @Id
    @ManyToOne
    @NotNull(message = "May not be empty")
    private User receiver;
    
    
    @Id
    @NotNull(message = "May not be empty")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creationTime;
    
    
    @NotNull(message = "May not be empty")
    private boolean unread;
    
    private int azione;//azione in italiano action è un nome riservato
    
    public Friend() {
    }

    public Friend(User sender, User receiver,Date time, boolean read ,int action) {
        this.receiver = receiver;
        this.sender = sender;
        this.creationTime=time;
        this.unread = read;
        this.azione=action;
    }
    
    public Date getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(Date time) {
        this.creationTime = time;
    }
    
    public User getReceiver() {
        return receiver;
    }

    public void setReceiver(User receiver) {
        this.receiver = receiver;
    }

    public User getSender() {
        return sender;
    }

    public void setSender(User sender) {
        this.sender = sender;
    }
    
    public boolean getUnread() {
        return unread;
    }

    public void setUnread(boolean unread) {
        this.unread = unread;
    }

public int getAzione()
{
  return azione;  
}
public void setAzione(int value)
{
    this.azione=value;
}

    
}
